/*
 * > /*
>  * INSANE - Interactive Structural Analysis Environment
>  *
>  * Copyright (C) 2003-2004
>  * Universidade Federal de Minas Gerais
>  * Escola de Engenharia
>  * Departamento de Engenharia de Estruturas
>  *
>  * Author's email :     insane@dees.ufmg.br
>  * Author's Website :   http://www.dees.ufmg.br/insane
>  *
>  * This program is free software; you can redistribute it and/or
>  * modify it under the terms of the GNU General Public License
>  * as published by the Free Software Foundation; either version 2
>  * of the License, or any later version.
>  *
>  * This program is distributed in the hope that it will be useful,
>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  * GNU General Public License for more details.
>  *
>  * You should have received a copy of the GNU General Public License
>  * along with this program; if not, write to the Free Software
>  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-
> 1307, USA.
 *
 */

package br.ufmg.dees.insane.model.postp;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;

public class GeoPostpModel implements Serializable{

	/**   */
	private static final long serialVersionUID = 1L;
	/** The label of this postpStep */
	private String label;
	/** The values of this Step  */
	private HashMap<String, Double> stepValues ; 
	/** The patches list of this PostpModel */
	private ArrayList<Patch> patches;
	/** The boundaries list of this PostpModel */
	private ArrayList<Boundary> boundaries;
	/** The points list of this PostpModel */
	private ArrayList<PointModel> points;
	
	private ArrayList<String> keys;
    
//    /** The points list of this PostpModel */
//    private GeoPostpModel gaussStepPostp;
	
	public GeoPostpModel(){
		this.stepValues = new HashMap<String, Double>();
		this.keys = new ArrayList<String>();
		this.patches = new ArrayList<Patch>();
		this.boundaries = new ArrayList<Boundary>();
		this.points = new ArrayList<PointModel>();
	}

	/** 
	 * The constructor constructs the PostpModel and initialize the points list, 
	 * the patches list and the boundaries list from the parameters 
	 * points, patches and boundaries respectively.
	 * @param points The points list of this PostpModel
	 * @param patches The patches list of this PostpModel
	 * @param boundaries The boundaries list of this PostpModel
	 */
	public GeoPostpModel(ArrayList<PointModel> points, ArrayList<Patch> patches, ArrayList<Boundary> boundaries) {
		this.stepValues = new HashMap<String, Double>();
		this.keys = new ArrayList<String>();
		this.points = points;
		this.patches = patches;
		this.boundaries = boundaries;
	}

	/** 
	 * The constructor constructs the PostpModel and initialize the points list 
	 * and the boundaries from the parameters points and boundaries respectively.
	 * @param points The points list of this PostpModel
	 * @param boundaries The boundaries list of this PostpModel
	 */
	public GeoPostpModel(ArrayList<PointModel> points, ArrayList<Boundary> boundaries) {
		this.stepValues = new HashMap<String, Double>();
		this.keys = new ArrayList<String>();
		this.points = points;
		this.boundaries = boundaries;
	}
	
	/** 
	 * The constructor constructs the PostpModel and initialize 
	 * the points list from the parameter points.
	 * @param points The points list of this PostpModel
	 */
	public GeoPostpModel(ArrayList<PointModel> points) {
		this.stepValues = new HashMap<String, Double>();
		this.keys = new ArrayList<String>();
		this.points = points;
	}

	/**
	 * This method return the pointModel of respective label
	 * @param label The label of the point.
	 * @return p The PointModel.
	 */
	public PointModel getPointModel(String label){
		PointModel p;
		for(int i =0;i<this.points.size();i++){
			if(label.equals(((PointModel)this.points.get(i)).getLabel())){
				p = ((PointModel)this.points.get(i));
				return p;
			}
		}
		return null;
	}
	
	/**
	 * This method set the pointModel of respective label 
	 * from the parameters poinModel and label.
	 * @param label The label of the point to be set.
	 * @param p The PointModel to be set.
	 */
	public void setPointModel(String label, PointModel pointModel) {
		for(int i =0;i<this.points.size();i++){
			if(label.equals(((PointModel)this.points.get(i)).getLabel())){
				int cont =  this.points.indexOf((PointModel)this.points.get(i));
				this.points.remove((PointModel)this.points.get(i));
				this.points.set(cont,pointModel);
			}
		}
	}
	
	/**
	 * This method return the patch of respective label
	 * @param label The label of the patch.
	 * @return p The patch.
	 */
	public Patch getPatch(String label){
		Patch p = new Patch();
		for(int i =0;i<this.patches.size();i++){
			if(label.equals(((Patch)this.patches.get(i)).getLabel())){
				p = ((Patch)this.patches.get(i));
			}
		}
			return p;
	}
	
	/**
	 * This method set the patch of respective label 
	 * from the parameters patch and label.
	 * @param label The label of the patch to be set.
	 * @param patch The patch to be set.
	 */
	public void setPatch(String label, Patch patch) {
		for(int i =0;i<this.patches.size();i++){
			if(label.equals(((Patch)this.patches.get(i)).getLabel())){
				int cont = this.patches.indexOf((Patch)this.patches.get(i));
				this.patches.remove((Patch)this.patches.get(i));
				this.patches.set(cont,patch);
			}
		}
	}
	
	/**
	 * This method return the boundary of respective label
	 * @param label The label of the boundary.
	 * @return p The boundary.
	 */
	public Boundary getBoundaries(String label){
		Boundary p = new Boundary();
		for(int i =0;i<this.boundaries.size();i++){
			if(label.equals(((Boundary)this.boundaries.get(i)).getLabel())){
				p = ((Boundary)this.boundaries.get(i));
			}
		}
			return p;
	}
	
	/**
	 * This method set the Boundary of respective label 
	 * from the parameters Boundary and label.
	 * @param label The label of the Boundary to be set.
	 * @param patch The Boundary to be set.
	 */
	public void setBoundary(String label, Boundary boundary) {
		for(int i =0;i<this.boundaries.size();i++){
			if(label.equals(((Boundary)this.boundaries.get(i)).getLabel())){
				int cont =  this.boundaries.indexOf((Boundary)this.boundaries.get(i));
				this.boundaries.remove((Boundary)this.boundaries.get(i));
				this.boundaries.set(cont,boundary);
			}
		}
	}
		
	/**
	 * The method return the boundaries.
	 * @return Returns The boundaries.
	 */
	public ArrayList<Boundary> getBoundaries() {
		return boundaries;
	}

	/**
	 * The method set the field boundaries from the parameter boundaries.
	 * @param boundaries The boundaries to set.
	 */
	public void setBoundaries(ArrayList<Boundary> boundaries) {
		this.boundaries = boundaries;
	}

	/**
	 * The method return the patches.
	 * @return Returns The patches.
	 */
	public ArrayList<Patch> getPatches() {
		return patches;
	}

	/**
	 * The method set the field patches from the parameter patches.
	 * @param patches The patches to set.
	 */
	public void setPatches(ArrayList<Patch> patches) {
		this.patches = patches;
	}

	/**
	 * The method return the points.
	 * @return Returns The points.
	 */
	public ArrayList<PointModel> getPoints() {
		return points;
	}

	/**
	 * The method set the field points from the parameter points.
	 * @param points The points to set.
	 */
	public void setPoints(ArrayList<PointModel> points) {
		this.points = points;
	}
	
	/** 
	 * The method put a value with respective key, in values HashMap.
	 * @param key The key of the value.
	 * @param value The respective value.
	 */
	public void putStepValue(String key, Double value){
		this.stepValues.put(key,value);
		this.keys.add(key);
	}
	
	/**
	 * The method return a value relative to the passed key
	 * @param key The key of the value that will be the return. 
	 * @return The respective value of the Key.
	 */
	public Double getStepValue(String key){
		return (Double)this.stepValues.get(key);
	}
	
	/**
	 * The method return the keys.
	 * @return Returns The keys.
	 */
	public ArrayList<String> getKeys() {
		return keys;
	}

	/**
	 * The method set the field keys from the parameter keys.
	 * @param keys The keys to set.
	 */
	public void setKeys(ArrayList<String> keys) {
		this.keys = keys;
	}

	/**
	 * The method return the label.
	 * @return Returns The label.
	 */
	public String getLabel() {
		return label;
	}

	/**
	 * The method set the field label from the parameter label.
	 * @param label The label to set.
	 */
	public void setLabel(String label) {
		this.label = label;
	}

	/**
	 * The method return the values.
	 * @return Returns The values.
	 */
	public HashMap<String, Double> getStepValues() {
		return this.stepValues;
	}

	/**
	 * The method set the field values from the parameter values.
	 * @param values The values to set.
	 */
	public void setStepValues(HashMap<String, Double> values) {
		this.stepValues = values;
	}

//    public GeoPostpModel getGaussStepPostp() {
//        return gaussStepPostp;
//    }
//
//    public void setGaussStepPostp(GeoPostpModel gaussStepPostp) {
//        this.gaussStepPostp = gaussStepPostp;
//    }
	
//************************************************************	
}//end of this class
